﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ArtMath
{
    public class clsForchar
    {
        char chr;
        bool italic;
        Color color;
        PictureBox pb;
        SizeD size;
        double widthRate = 0.45f, heightRate = 0.1f;
        clsNormal text;
        public int index;
        public clsForchar(PictureBox pb, clsNormal text, char chr, Color color, int index, bool italic = false)
        {
            this.pb = pb;
            this.text = text;
            this.chr = chr;
            this.color = color;
            this.index = index;
            this.italic = italic;
            pb.Invalidate();
        }
        public char Char
        {
            get { return chr; }
            set
            {
                chr = value;
                pb.Invalidate();
            }
        }
        public bool Italic
        {
            get { return italic; }
            set
            {
                italic = value;
                pb.Invalidate();
            }
        }
        public Color Color
        {
            get { return color; }
            set
            {
                color = value;
                pb.Invalidate();
            }
        }
        public double WidthRate
        {
            get { return widthRate; }
            set
            {
                double tmp = text.Size.Width - size.Width;
                size.Width = size.Width / widthRate * value;
                text.Size = new SizeD(tmp + size.Width, text.Size.Height);
                widthRate = value;
                pb.Invalidate();
            }
        }
        public double HeightRate
        {
            get { return heightRate; }
            set
            {
                heightRate = value;
                pb.Invalidate();
            }
        }
        public double Yoffset
        {
            get { return size.Height * heightRate; }
        }
        public SizeD Size
        {
            get { return size; }
            set
            {
                size = new SizeD(value.Width * widthRate, value.Height * 0.8f);
            }
        }
    }
}
